import { useState } from 'react'
import logo from './logo.svg'
import './App.css'
import { useI18n,setLang } from './lang';
import i18n from './i18n';



function App() {

  const data = useI18n();
  const [lang,setNewLang] = setLang();
  function changeLang(e) {
    console.log('触发');
    setNewLang(e.target.value)
  }
  return (
    <div className="App">
    <h1>{data.welcome}</h1>
    <select onClick={changeLang}>
      {Object.keys(i18n).map((lang,key) => {
        return <option key={key} value={lang} >{lang}</option>
      })}
    </select>
    
    </div>
  )
}

export default App
